package thread;

public class TEST {
    private static class MyRunnable implements Runnable {
        public void run() {
            while (!Thread.interrupted()) {
                System.out.println(Thread.currentThread().getName());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    System.err.println();
                    break;
                }
            }
        }

        public static void main(String[] args) throws InterruptedException {
            MyRunnable mt = new MyRunnable();
            Thread thread = new Thread(mt, "VN线程");
            System.out.println("VN正在对线");
            thread.start();
            Thread.sleep(5 * 1000);
            thread.interrupt();
        }
    }
}
